        // 平滑滚动函数
        function smoothScroll(targetId) {
            const targetElement = document.querySelector(targetId);
            if (targetElement) {
                window.scrollTo({
                    top: targetElement.offsetTop - 20,
                    behavior: 'smooth'
                });
            }
        }
        
        // 为所有导航链接添加点击事件
        document.querySelectorAll('.shell__item').forEach(item => {
            item.addEventListener('click', function(e) {
                e.preventDefault();
                const targetId = this.getAttribute('href');
                
                // 更新活动状态
                document.querySelectorAll('.shell__item').forEach(link => {
                    link.classList.remove('active');
                });
                this.classList.add('active');
                
                // 平滑滚动到目标区域
                smoothScroll(targetId);
            });
        });
        
        // 为页脚链接添加点击事件
        document.querySelectorAll('.links a').forEach(item => {
            item.addEventListener('click', function(e) {
                e.preventDefault();
                const targetId = this.getAttribute('href');
                
                // 更新导航栏活动状态
                document.querySelectorAll('.shell__item').forEach(link => {
                    link.classList.remove('active');
                    if (link.getAttribute('href') === targetId) {
                        link.classList.add('active');
                    }
                });
                
                // 平滑滚动到目标区域
                smoothScroll(targetId);
            });
        });
        
        // 监听滚动事件，更新活动状态
        window.addEventListener('scroll', function() {
            const sections = document.querySelectorAll('.section, #footer');
            let currentSection = '';
            
            sections.forEach(section => {
                const sectionTop = section.offsetTop;
                const sectionHeight = section.clientHeight;
                if (pageYOffset >= sectionTop - 100) {
                    currentSection = '#' + section.getAttribute('id');
                }
            });
            
            document.querySelectorAll('.shell__item').forEach(item => {
                item.classList.remove('active');
                if (item.getAttribute('href') === currentSection) {
                    item.classList.add('active');
                }
            });
        });